#include <stdio.h>
#include <string.h>

char s[600][600];

void draw(int y, int x)
{
	s[y][x] = '+'; s[y][x+1] = '-'; s[y][x+2] = '-'; s[y][x+3] = '-'; s[y][x+4] = '+'; 
	s[y+1][x] = '|'; s[y+1][x+1] = ' '; s[y+1][x+2] = ' '; s[y+1][x+3] = ' '; s[y+1][x+4] = '|'; s[y+1][x+5] = '/'; 
	s[y+2][x] = '|'; s[y+2][x+1] = ' '; s[y+2][x+2] = ' '; s[y+2][x+3] = ' '; s[y+2][x+4] = '|'; s[y+2][x+5] = ' '; s[y+2][x+6] = '+'; 
	s[y+3][x] = '+'; s[y+3][x+1] = '-'; s[y+3][x+2] = '-'; s[y+3][x+3] = '-'; s[y+3][x+4] = '+'; s[y+3][x+5] = ' '; s[y+3][x+6] = '|'; 
	s[y+4][x+1] = '/'; s[y+4][x+2] = ' '; s[y+4][x+3] = ' '; s[y+4][x+4] = ' '; s[y+4][x+5] = '/'; s[y+4][x+6] = '|'; 
	s[y+5][x+2] = '+'; s[y+5][x+3] = '-'; s[y+5][x+4] = '-'; s[y+5][x+5] = '-'; s[y+5][x+6] = '+'; 
}

int main(int argc, char *argv[])
{
	int a[55][55];
	int x1, y1, t, x, y;
	int i, j, k;
	int m, n;
	char buf[256], *ps;

	gets(buf);
	m = atoi(strtok(buf, " "));
	n = atoi(strtok(NULL, " "));

	x1 = 4*n + 2*m + 1;
	y1 = 0;

	for (i=0; i<m; i++) {
		gets(buf);
		for (ps=strtok(buf, " "), j=0; ps; ps=strtok(NULL, " "), j++) {
			a[i][j] = atoi(ps);
			t = 3*a[i][j] + 2*(m-i) + 1;
			if (t > y1) y1 = t;
		}
	}

	for (i=0; i<y1; i++) {
		for (j=0; j<x1; j++) {
			s[i][j] = '.';
		}
	}

	for (i=0; i<m; i++) {
		for (j=0; j<n; j++) {
			for (k=0; k<a[i][j]; k++) {
				x = 2*(m-i-1) + 4*j;
				y = 2*(m-i-1) + 3*k;
				draw(y, x);
			}
		}
	}

	for (i=y1-1; i>=0; i--) {
		for (j=0; j<x1; j++) {
			printf("%c", s[i][j]);
		}
		printf("\n");
	}

	return 0;
}
